import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import { fileURLToPath } from 'node:url'
import qiankun from 'vite-plugin-qiankun'

function resolveRoot(path: string) {
  return fileURLToPath(new URL(path, import.meta.url))
}

// https://vite.dev/config/
export default defineConfig({
  server: {
    port: 3000
  },
  plugins: [
    // react(), // 微前端开发要隐藏这个
    qiankun('amuer', { // 微应用名字，与主应用注册的微应用名字保持一致
      useDevMode: true
    })
  ],
  resolve: {
    alias: {
      '@': resolveRoot('src')
    }
  }
})
